import { createLogger, format, transports } from 'winston';
import chalk from 'chalk';

const logger = createLogger({
  format: format.combine(
    format.label({ label: chalk.cyan('[typeorm-demo]') }),
    format.colorize({ all: true }),
    format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
    format.simple(),
    format.printf((info) => {
      return `${info.label} ${chalk.gray(info.timestamp)}: ${info.message}`;
    }),
  ),
  transports: [new transports.Console()],
});

export { logger };
